package cn.baiweigang.uu.enums;

public enum PeriodEnum {
    MIN1("1min", "1分钟"),
    MIN5("5min", "5分钟"),
    MIN15("15min", "15分钟"),
    MIN30("30min", "30分钟"),
    MIN60("60min", "1小时"),
    HOUR4("4hour", "4小时"),
    DAY1("1day", "1天"),
    WEEK1("1week", "1周"),
    MON1("1mon", "1年"),
    ;
    private String code;
    private String desc;

    PeriodEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PeriodEnum getPeriodEnumByCode(String code) {
        PeriodEnum[] periodEnums = values();
        for (int i = 0; i < periodEnums.length; i++) {
            if (code != null && code.equalsIgnoreCase(periodEnums[i].getCode())) {
                return periodEnums[i];
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
